<template>
    <div class="StartProcess1">
        <div class="shareHeadClass" style="margin-top: 4px">
            <p class="colCLas"></p>
            <p class="info">申请信息</p>
        </div>
        <el-form
            :model="$store.state.invoice2.invoinceFormStart1"
            ref="selfForm"
            label-width="100px"
            class="formInline"
            size="small"
            :disabled="isLook"
        >
            <el-row >
                <el-col :span="12">
                    <el-form-item label="发起人" prop="applyUsername">
                        <el-input
                            v-model="
                                $store.state.invoice2.invoinceFormStart1.applyUsername
                            "
                            :disabled="true"
                        ></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="发起时间" prop="createTime">
                        <el-input
                            class="width70"
                            v-model="
                                $store.state.invoice2.invoinceFormStart1.createTime
                            "
                            :disabled="true"
                        ></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row v-if="busType === ('FLOW_YFMLY')">
                <el-col :span="12" >
                    <el-form-item label="领用数量" >
                        <el-input
                            :disabled="true"
                            v-model="$store.state.invoice2.busData.lysl"
                        ></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row v-if="busType === ('FLOW_XZSXED') || busType === ('FLOW_THSXED')">
                <el-col :span="12" >
                    <el-form-item label="申请金额" >
                        <el-input
                            :disabled="true"
                            v-model="$store.state.invoice2.busData.applyLimit"
                        ></el-input>元
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12" v-if="busType === ('FLOW_SGKP')">
                    <el-form-item label="发票类型" prop="fplx">
                        <el-select
                            :disabled="idDisabledFPLX"
                            v-model="
                                $store.state.invoice2.busData.fppz
                            "
                            placeholder="请选择"
                        >
                            <el-option label="数电专票" value="01"></el-option>
                            <el-option label="数电普票" value="02"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>

                <el-col :span="12" >
                    <el-form-item label="即将流向" v-if="isShowJJLX">
                        <el-select
                            v-model="
                                $store.state.invoice2.invoinceFormStart1.approvalUser
                            "
                            placeholder="请选择"
                            :disabled="isDisabledJJLX"
                        >
                            <el-option
                                :label="info.fullName"
                                :value="info.userCode"
                                :key="info.userCode"
                                v-for="info in $store.state.invoice2.invoinceFormStart1.approvalUserList"
                            ></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <div>
                <el-form-item label="事项说明" prop="desc">
                    <el-input
                        :disabled="isDisabledSXSM"
                        type="textarea"
                        v-model="
                            $store.state.invoice2.invoinceFormStart1.description
                        "
                        maxlength="500"
                        show-word-limit
                        :rows="7"
                    ></el-input>
                </el-form-item>
            </div>
        </el-form>
    </div>
</template>

<script>
// 开始流程
import { formatParams } from './formatParams.js'

export default {
    name: 'StartProcess1',
    props: ['flag', 'isLook','nodeId','busType'],
    data() {
        return {

        }
    },
    created() {
        try {
            let obj = JSON.parse(
                sessionStorage.getItem('handleDetailInfo')
            )
            this.getFirst(obj.busType, obj.busId)
        } catch (error) {}
    },
    computed: {
        idDisabledFPLX(){
            return   this.nodeId != ''&& this.nodeId != null&& this.nodeId != undefined
        },
        isDisabledJJLX(){
            return    !(this.nodeId == 'root') &&  !(this.nodeId === '' ||  this.nodeId === null || this.nodeId === undefined )
        },
        isDisabledSXSM(){
            return    this.nodeId != 'root' && this.nodeId != '' && this.nodeId != null && this.nodeId != undefined
        },
        isShowJJLX(){
            return  this.nodeId == 'root' ||  (this.nodeId === '' ||  this.nodeId === null || this.nodeId === undefined )
        },
    },
    methods: {
        getFirst(busType, busId) {
            let params = formatParams({busType, busId})
            console.log(params);
            this.$store.dispatch('invoice2/getFirst', params)
        },


    },
}
</script>

<style lang = "scss" scoped>
.StartProcess1 {
    .formInline {
        width: 100%;
        // margin: 0 auto;

        ::v-deep .el-input--small {
            width: 70%;
        }
        ::v-deep .el-textarea {
            width: 100%;
        }
        ::v-deep .el-select--small {
            width: 100%;
        }
        :deep .el-form-item--small {
            margin-bottom: 4px;
        }
        //  .width70{
        //     width:70%;
        //  }
    }
}
</style>
